{{ if .Site.Params.widgets.categories }}
{{ if isset .Site.Taxonomies "categories" }}
{{ if not (eq (len .Site.Taxonomies.categories) 0) }}
<div class="panel panel-default sidebar-menu">

    <div class="panel-heading">
        <h3 class="panel-title">{{ i18n "categoriesTitle" }}</h3>
    </div>

    <div class="panel-body">
        <ul class="nav nav-pills nav-stacked">
            {{ $current := . }}
            {{ range $name, $items := .Site.Taxonomies.categories }}
            <li{{ if eq $current.RelPermalink ($name | urlize | lower | printf "/categories/%s/") }} class="active"{{ end }}>
                <a href="{{ "categories/" | relLangURL }}{{ $name | urlize | lower }}">{{ $name | upper }} ({{ len $items }})</a>
            </li>
            {{ end }}
        </ul>
    </div>

</div>
{{ end }}
{{ end }}
{{ end }}
